package src.reflect;

import src.reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/*
反射机制访问注解参数
 */
public class ReflectDemo8 {
        public static void main(String[] args) throws Exception {
                Class cls=Class.forName("reflect.Person");
                Method method= cls.getDeclaredMethod("sayHello");
                if (method.isAnnotationPresent(AutoRunMethod.class)){
                        AutoRunMethod arm=method.getAnnotation(AutoRunMethod.class);
                        int value=arm.value();
                        System.out.println("参数value的值为："+value);
                }
        }
}
